home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / cpp_libs / answrbok / 6_11.lha / 6_11 / 6_11_cmp.c < prev    next >
Text File  |  1993-08-08  |  483b  |  22 lines

  1. * Copyright (c) 1990 by AT&T Bell Telephone Laboratories, Incorporated. */
  2. * The C++ Answer Book */
  3. * Tony Hansen */
  4. * All rights reserved. */
  5. *
  6.    Compare the n ARB_type's pointed
  7.    to by l1 and l2. Return -1, 0 or 1
  8.    dependent on whether l1 is less than,
  9.    equal or greater than l2.
  10. /
  11. include <arbint.h>
  12.  
  13. nt arb_cmp(const ARB_type *l1,
  14.    const ARB_type *l2, int n)
  15.  
  16.    if (l1 != l2)
  17. while (--n >= 0)
  18.     if (*l1++ != *l2++)
  19.     return (l1[-1] > l2[-1] ? 1 : -1);
  20.    return (0);
  21.  
  22.